package com.summer.mall.service.impl;

import com.summer.mall.common.ResponseService;
import com.summer.mall.mapper.OrderMapper;
import com.summer.mall.mapper.ProductMapper;
import com.summer.mall.mapper.UserMapper;
import com.summer.mall.service.StatisticService;
import com.summer.mall.vo.StatisticVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("statisticService")
public class StatisticServiceImpl implements StatisticService {
    @Autowired
    private UserMapper userMapper;
    @Autowired
    private OrderMapper orderMapper;
    @Autowired
    private ProductMapper productMapper;

    /**
     * 三大数据查询
     * @return
     */
    @Override
    public ResponseService<StatisticVo> basecount() {
        StatisticVo statisticVo = new StatisticVo();
        statisticVo.setUserCount(userMapper.getCount());
        statisticVo.setOrderCount(orderMapper.getCount());
        statisticVo.setProduceCount(productMapper.getCount());
        return ResponseService.createBySuccess(statisticVo);
    }
}
